package com.rd.student.dashuju.sunwenzhuo.Test1.fighting;

import java.util.Random;

public class FightingGame2 {
    private String sex;
    private String name;
    private int blood;

    public void setName(String name) {
        this.name = name;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public void setBlood(int blood) {
        this.blood = blood;
    }

    public String getName() {
        return name;
    }

    public String getSex() {
        return sex;
    }

    public int getBlood() {
        return blood;
    }

    public FightingGame2() {

    }

    public static void fight(int blood1, int blood2, String name1, String name2) {
        //attack 攻击描述：
        String[] attacks_desc = {
                "使出了一招【背心钉】，转到对方的身后，一掌向他背心的灵台穴拍去。",
                "使出了一招【游空探爪】，飞起身形自半空中变掌为抓锁向他。",
                "大喝一声，身形下伏，一招【劈雷坠地】，捶向他双腿。",
                "运气于掌，一瞬间掌心变得血红，一式【掌心雷】，推向他。",
                "阴手翻起阳手跟进，一招【没遮拦】，结结实实的捶向他。",
                "上步抢身，招中套招，一招【劈挂连环】，连环攻向他。"};

        //injured 受伤描述：
        String[] injureds_desc = {
                "退了半步，毫发无损",
                "给造成一处瘀伤",
                "被一击命中，痛得弯下腰",
                "痛苦地闷哼了一声，显然受了点内伤",
                "摇摇晃晃，一跤摔倒在地",
                "脸色一下变得惨白，连退了好几步",
                "『轰』的一声，口中鲜血狂喷而出",
                "一声惨叫，像滩软泥般塌了下去"};
        int min = 1;
        int max = 100;
        Random random = new Random();
        while (true) {

            int hurt1 = min + random.nextInt(max - min);
            int hurt2 = min + random.nextInt(max - min);
            int attacks1 =random.nextInt(6);
            int attacks2 =random.nextInt(6);
            int injureds1 =random.nextInt(8);
            int injureds2 =random.nextInt(8);


            if (blood1 > 0) {
                blood1 = blood1 - hurt1;
                System.out.println(name2 + attacks_desc[attacks2]  + name1 + injureds_desc[injureds1]);

            } else if (blood1 <= 0) {
                System.out.println(name2 + "K.O了" + name1);
                break;
            }
            if (blood2 > 0) {
                blood2 = blood2 - hurt2;
                System.out.println(name1 +attacks_desc[attacks1]+ name2 + injureds_desc[injureds2]);
            } else if (blood2 <= 0) {
                System.out.println(name1 + "K.O了" + name2);
                break;
            }
        }
    }

}